package com.share.test.example.selenium;

import com.alibaba.fastjson.JSON;
import com.share.common.utils.DateExtUtil;
import com.share.example.selenium.model.amazon.seller.ClosePromoteForm;
import com.share.example.selenium.model.amazon.seller.ClosePromoteTask;
import com.share.example.selenium.utils.UsDateUtil;
import org.junit.Test;

import java.util.Date;
import java.util.List;

public class Amazon_Seller extends _TestBase {

    @Test
    public void sellerLogin() {
        //1.打开页面
        Boolean aBoolean = amazonSellerLogin.openLoginPage();

        //2.填充表单
        amazonSellerLogin.fixLoginform("1232", "Fdaf");
    }

    @Test
    public void batchClosePromotion() {
        Date date = DateExtUtil.addDay(1);
        String usDateTime = UsDateUtil.toYYYYMMDDHHMMSS(date);

        ClosePromoteTask task = new ClosePromoteTask();
        task.setStartPage(4);
        task.setDealSize(3);
        task.setStartFilter2(usDateTime);
        List<ClosePromoteForm> closePromoteForms = sellerPromotionService.batchClosePromotion(false, task);

        System.out.println(JSON.toJSON(closePromoteForms));
    }

    @Test
    public void closePromotion() {
        String url = "https://sellercentral.amazon.com/promotions/view?promotionId=A11FYI5NPIKYTL";
        Boolean aBoolean = sellerPromotionService.closePromotion(DateExtUtil.getDateTime(), new ClosePromoteForm(url), true);
        System.out.println(aBoolean);
    }
}
